// Copyright (c) 2011, Grant China
// All rights reserved.

package org.gwtlcars.ui;

import java.util.Vector;

import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public abstract class LcarsPanel extends Composite {

    int hpanel_idx;
    int vpanel_idx;
    Vector<LcarsPanelButton> radio_buttons = new Vector<LcarsPanelButton>();

    @UiField
    protected DockLayoutPanel dock;

    protected String color = LcarsColor.LIGHT_ORANGE;

    public abstract void setColor(String lcars_color);

    public abstract LcarsPanelButton addHorizontalButton(String html);

    public abstract LcarsPanelButton addVerticalButton(String html);

    public LcarsPanelButton addHorizontalPushButton(String html) {
        LcarsPanelButton button = addHorizontalButton(html);
        button.setDownColor(LcarsColor.LIGHT_YELLOW);
        return button;
    }

    public LcarsPanelButton addVerticalPushButton(String html) {
        LcarsPanelButton button = addVerticalButton(html);
        button.setDownColor(LcarsColor.LIGHT_YELLOW);
        return button;
    }

    public LcarsPanelButton addHorizontalRadioButton(String text, String group) {
        LcarsPanelButton button = addHorizontalPushButton(text);
        button.setGroupName(group);
        radio_buttons.add(button);
        return button;
    }

    public Vector<LcarsPanelButton> getRadioButtons() {
        return radio_buttons;
    }

    public Widget add(Widget w) {
        dock.add(w);
        return w;
    }
}
